<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
    <title>ACE编辑器</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="${ctx}/assets/css/ace.edit.css"/>
    <link href="assets/css/bootstrap.min.css" rel="stylesheet"/>
    <link id="beyond-link" href="assets/css/beyond.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="sourceTree">
    <!--左侧为资源文件树-->
</div>
<div id="lengthwaysExpander"></div>
<div id="sqlEdit">
    <!--编辑器-->
    <div id="editor"></div>
    <div id="consoleAndResult">
        <div id="toolsBar">
            <select class="selectpicker" style="min-width: 150px;" onchange="setEditFontSize(this.value) ">
                <optgroup label="编辑器字体大小">
                    <option value="12px">12px</option>
                    <option value="14px">14px</option>
                    <option value="16px">16px</option>
                    <option value="18px">18px</option>
                    <option value="24px" selected="selected">24px</option>
                    <option value="32px">32px</option>
                    <option value="56px">56px</option>
                    <option value="72px">72px</option>
                </optgroup>
            </select>
            <select class="selectpicker" style="min-width: 200px;" onchange="setEditTheme(this.value)" id="editorTheme">
                <optgroup label="编辑器主题">
                    <option value="ambiance">ambiance</option>
                    <option value="chaos">chaos</option>
                    <option value="chrome">chrome</option>
                    <option value="clouds">clouds</option>
                    <option value="clouds_midnight">clouds_midnight</option>
                    <option value="cobalt">cobalt</option>
                    <option value="crimson_editor">crimson_editor</option>
                    <option value="dawn">dawn</option>
                    <option value="dreamweaver">dreamweaver</option>
                    <option value="eclipse">eclipse</option>
                    <option value="github">github</option>
                    <option value="idle_fingers">idle_fingers</option>
                    <option value="iplastic">iplastic</option>
                    <option value="katzenmilch">katzenmilch</option>
                    <option value="kr_theme">kr_theme</option>
                    <option value="kuroir">kuroir</option>
                    <option value="merbivore">merbivore</option>
                    <option value="merbivore_soft">merbivore_soft</option>
                    <option value="monokai">monokai</option>
                    <option value="mono_industrial">mono_industrial</option>
                    <option value="pastel_on_dark">pastel_on_dark</option>
                    <option value="solarized_dark">solarized_dark</option>
                    <option value="solarized_light">solarized_light</option>
                    <option value="sqlserver">sqlserver</option>
                    <option value="terminal">terminal</option>
                    <option value="textmate">textmate</option>
                    <option value="tomorrow">tomorrow</option>
                    <option value="tomorrow_night">tomorrow_night</option>
                    <option value="tomorrow_night_blue">tomorrow_night_blue</option>
                    <option value="tomorrow_night_bright">tomorrow_night_bright</option>
                    <option value="tomorrow_night_eighties">tomorrow_night_eighties</option>
                    <option value="twilight">twilight</option>
                    <option value="vibrant_ink">vibrant_ink</option>
                    <option value="xcode" selected="selected">xcode</option>
                </optgroup>
            </select>
            <select class="selectpicker" style="min-width: 120px;" onchange="setEditMode(this.value)" id="editorMode">
                <optgroup label="语言环境">
                    <option value="ftl">ftl</option>
                    <option value="jsp">jsp</option>
                    <option value="html">html</option>
                    <option value="xml">xml</option>
                    <option value="css">css</option>
                    <option value="javascript">javascript</option>
                    <option value="json">json</option>
                    <option value="java">java</option>
                    <option value="sql">sql</option>
                    <option value="mysql" selected="selected">mysql</option>
                    <option value="sqlserver">sqlserver</option>
                    <option value="text">text</option>
                    <option value="properties">properties</option>
                    <!--
                        以下为支持的全部环境
                        <option value="abap">abap</option>
                        <option value="abc">abc</option>
                        <option value="actionscript">actionscript</option>
                        <option value="ada">ada</option>
                        <option value="apache_conf">apache_conf</option>
                        <option value="applescript">applescript</option>
                        <option value="asciidoc">asciidoc</option>
                        <option value="assembly_x86">assembly_x86</option>
                        <option value="autohotkey">autohotkey</option>
                        <option value="batchfile">batchfile</option>
                        <option value="bro">bro</option>
                        <option value="c9search">c9search</option>
                        <option value="cirru">cirru</option>
                        <option value="clojure">clojure</option>
                        <option value="cobol">cobol</option>
                        <option value="coffee">coffee</option>
                        <option value="coldfusion">coldfusion</option>
                        <option value="csharp">csharp</option>
                        <option value="css">css</option>
                        <option value="curly">curly</option>
                        <option value="c_cpp">c_cpp</option>
                        <option value="d">d</option>
                        <option value="dart">dart</option>
                        <option value="diff">diff</option>
                        <option value="django">django</option>
                        <option value="dockerfile">dockerfile</option>
                        <option value="dot">dot</option>
                        <option value="drools">drools</option>
                        <option value="eiffel">eiffel</option>
                        <option value="ejs">ejs</option>
                        <option value="elixir">elixir</option>
                        <option value="elm">elm</option>
                        <option value="erlang">erlang</option>
                        <option value="forth">forth</option>
                        <option value="fortran">fortran</option>
                        <option value="ftl">ftl</option>
                        <option value="gcode">gcode</option>
                        <option value="gherkin">gherkin</option>
                        <option value="gitignore">gitignore</option>
                        <option value="glsl">glsl</option>
                        <option value="gobstones">gobstones</option>
                        <option value="golang">golang</option>
                        <option value="groovy">groovy</option>
                        <option value="haml">haml</option>
                        <option value="handlebars">handlebars</option>
                        <option value="haskell">haskell</option>
                        <option value="haskell_cabal">haskell_cabal</option>
                        <option value="haxe">haxe</option>
                        <option value="hjson">hjson</option>
                        <option value="html">html</option>
                        <option value="html_elixir">html_elixir</option>
                        <option value="html_ruby">html_ruby</option>
                        <option value="ini">ini</option>
                        <option value="io">io</option>
                        <option value="jack">jack</option>
                        <option value="jade">jade</option>
                        <option value="java">java</option>
                        <option value="javascript">javascript</option>
                        <option value="json">json</option>
                        <option value="jsoniq">jsoniq</option>
                        <option value="jsp">jsp</option>
                        <option value="jsx">jsx</option>
                        <option value="julia">julia</option>
                        <option value="kotlin">kotlin</option>
                        <option value="latex">latex</option>
                        <option value="less">less</option>
                        <option value="liquid">liquid</option>
                        <option value="lisp">lisp</option>
                        <option value="livescript">livescript</option>
                        <option value="logiql">logiql</option>
                        <option value="lsl">lsl</option>
                        <option value="lua">lua</option>
                        <option value="luapage">luapage</option>
                        <option value="lucene">lucene</option>
                        <option value="makefile">makefile</option>
                        <option value="markdown">markdown</option>
                        <option value="mask">mask</option>
                        <option value="matlab">matlab</option>
                        <option value="maze">maze</option>
                        <option value="mel">mel</option>
                        <option value="mushcode">mushcode</option>
                        <option value="mysql">mysql</option>
                        <option value="nix">nix</option>
                        <option value="nsis">nsis</option>
                        <option value="objectivec">objectivec</option>
                        <option value="ocaml">ocaml</option>
                        <option value="pascal">pascal</option>
                        <option value="perl">perl</option>
                        <option value="pgsql">pgsql</option>
                        <option value="php">php</option>
                        <option value="plain_text">plain_text</option>
                        <option value="powershell">powershell</option>
                        <option value="praat">praat</option>
                        <option value="prolog">prolog</option>
                        <option value="properties">properties</option>
                        <option value="protobuf">protobuf</option>
                        <option value="python">python</option>
                        <option value="r">r</option>
                        <option value="razor">razor</option>
                        <option value="rdoc">rdoc</option>
                        <option value="rhtml">rhtml</option>
                        <option value="rst">rst</option>
                        <option value="ruby">ruby</option>
                        <option value="rust">rust</option>
                        <option value="sass">sass</option>
                        <option value="scad">scad</option>
                        <option value="scala">scala</option>
                        <option value="scheme">scheme</option>
                        <option value="scss">scss</option>
                        <option value="sh">sh</option>
                        <option value="sjs">sjs</option>
                        <option value="smarty">smarty</option>
                        <option value="snippets">snippets</option>
                        <option value="soy_template">soy_template</option>
                        <option value="space">space</option>
                        <option value="sql">sql</option>
                        <option value="sqlserver">sqlserver</option>
                        <option value="stylus">stylus</option>
                        <option value="svg">svg</option>
                        <option value="swift">swift</option>
                        <option value="tcl">tcl</option>
                        <option value="tex">tex</option>
                        <option value="text">text</option>
                        <option value="textile">textile</option>
                        <option value="toml">toml</option>
                        <option value="tsx">tsx</option>
                        <option value="twig">twig</option>
                        <option value="typescript">typescript</option>
                        <option value="vala">vala</option>
                        <option value="vbscript">vbscript</option>
                        <option value="velocity">velocity</option>
                        <option value="verilog">verilog</option>
                        <option value="vhdl">vhdl</option>
                        <option value="wollok">wollok</option>
                        <option value="xml">xml</option>
                        <option value="xquery">xquery</option>
                        <option value="yaml">yaml</option>
                    -->
                </optgroup>
            </select>
            <#if editType[0]=="file">
                <a class="btn btn-default btn-xs" onclick="loadFile()" title="重加载(Alt+L)"><i class="fa fa-refresh green"></i>重加载</a>
                <a class="btn btn-default btn-xs" onclick="deletFile()" title="删除(Alt+Shift+D)"><i class="fa fa-trash-o danger"></i>删除</a>
                <a class="btn btn-default btn-xs" onclick="renameFile()" title="重命名(Alt+Shift+R)"><i class="fa fa-wrench yellow"></i>重命名</a>
            <#else>
                <a class="btn btn-default btn-xs" onclick="exec()" title="运行(Alt+R)"><i class="fa fa-play-circle green"></i>运行</a>
            </#if>
            <a class="btn btn-default btn-xs" onclick="save()" title="保存(Alt+S)"><i class="fa fa-save green"></i>保存</a>
        </div>
        <div id="crosswiseExpander"></div>
        <div class="console">

        </div>
    </div>
</div>
</body>
<script src="${ctx}/assets/js/jquery-2.0.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="${ctx}/assets/js/bootstrap.min.js"></script>
<script src="${ctx}/assets/js/bootbox/bootbox.js"></script>
<script src="assets/js/select2/select2.js"></script>
<script src="${ctx}/assets/js/custom/syscommons.js" type="text/javascript"></script>
<script src="${ctx}/assets/js/editors/aceEditor/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="${ctx}/assets/js/editors/aceEditor/ace/ext-language_tools.js" type="text/javascript" charset="utf-8"></script>
<script src="${ctx}/assets/js/editors/aceEditor/ace.edit.init.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    $(".selectpicker").select2();
    var ctx = "${ctx}";
    var sorceTreeViewUrl = "${sorceTreeViewUrl[0]}" || undefined;//左侧资源树视图路径
    var params = "${params[0]}" || {};//加载资源树时的参数
    var callback =  "${callback[0]}" || undefined;//资源树加载成功后的回调函数

    var executeCallback = "${executeCallback[0]}" || undefined;//点击执行按钮时的回调函数的回调函数
    var loadSelectFile =  "${loadSelectFile[0]}" || undefined;//点击加载文件内容时执行的回调函数
    var saveCallback = "${saveCallback[0]}" || undefined;//点击保存时的的回调函数
    var renameFileCallback = "${renameFileCallback[0]}" || undefined;//点击重命名时的的回调函数
    var deletFileCallback = "${deletFileCallback[0]}" || undefined;//点击删除时的的回调函数

    var extendCompleteData =  '${extendCompleteData[0]}' || [];//扩展自动补全数据
    var theme = "${theme[0]}" || "xcode";//编辑器主题
    var mode = "${mode[0]}" || "mysql";//编辑器编程语言模式

    if("${editType[0]}"=="file"){
        $("#editor").height($(window).height()-32);
        $("#consoleAndResult").height(32);
    }

    //社会之主题
    $("#editorTheme").val(theme);
    setEditTheme(theme);
    //设置编辑器语言模式
    $("#editorMode").val(mode);
    setEditMode(mode);
    /*
     meta：显示在提示框的右边
     caption：显示在提示框的左边
     value：是实际插入的数据
     score：表示优先级，高的排在前面
     */
    //扩展自动补全数据
    if (decodeURIComponent) {
        setCompleteData(eval(decodeURIComponent(extendCompleteData)));
    }
    //参数解码
    if (params) {
        params = decodeURIComponent(params);
    }
    //加载左侧资源树
    loadSourceTree(sorceTreeViewUrl, params, callback);
    function loadSourceTree(sorceTreeViewUrl, params, callback) {
        if (sorceTreeViewUrl == undefined) {
            return false;
        }
        if (params == undefined) {
            params = {};
        }
        ajaxRequest(sorceTreeViewUrl, params, function (result) {
            $("#sourceTree").html(result);
            if (callback) {
                if (typeof callback === "function") {
                    callback(result);
                } else if (typeof getTopWin()[callback] === "function") {
                    getTopWin()[callback](result);
                }
            }
        },
        function (XMLHttpRequest, textStatus, errorThrown) {
            ajaxError(errorThrown);
        }, "GET", "HTML");
    }
</script>
</html>